<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.54">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
span.s1 {font: 18.0px Helvetica}
span.s2 {color: #0000bf}
span.s3 {color: #000000}
span.s4 {color: #007300}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1"><b>Atari2600</b></span><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>TIA Chip Sound Simulator</b></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p1">Emulation of the sound generation hardware of the Atari TIA chip by Ron Fries.</p>
<p class="p2"><br></p>
<p class="p1"><b><span class="Apple-tab-span">	</span>*ar(audc0, audc1, audf0, audf1, audv0, audv1, rate)</b></p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>audc - tone control 0-15</p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>audf - frequency 0-31</p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>audv - volume 0-15</p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>rate - playback rate 1-... (&lt;1 gets weird)</p>
<p class="p3"><br></p>
<p class="p3"><br></p>
<p class="p4">s.boot;</p>
<p class="p4">{<span class="s2">Atari2600</span>.ar}.play</p>
<p class="p5"><br></p>
<p class="p4">{<span class="s2">Atari2600</span>.ar(2, 3, 10, 10, 5, 5)}.play</p>
<p class="p4">{<span class="s2">Atari2600</span>.ar(<span class="s2">MouseX</span>.kr(0, 15), <span class="s2">MouseY</span>.kr(0, 15), 10, 10, 5, 5)}.play</p>
<p class="p4">{<span class="s2">Atari2600</span>.ar(2, 3, <span class="s2">MouseX</span>.kr(0, 31), <span class="s2">MouseY</span>.kr(0, 31), 5, 5)}.play</p>
<p class="p4">{<span class="s2">Atari2600</span>.ar(2, 3, 10, 10, <span class="s2">MouseX</span>.kr(0, 15), <span class="s2">MouseY</span>.kr(0, 15))}.play</p>
<p class="p5"><br></p>
<p class="p4">{<span class="s2">Atari2600</span>.ar(<span class="s2">MouseX</span>.kr(0, 15), <span class="s2">SinOsc</span>.kr(0.35, 0, 7.5, 7.5), 10, <span class="s2">MouseY</span>.kr(0, 31), <span class="s2">SinOsc</span>.kr(0.3, 0, 5.5, 5.5), 5).dup}.play</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">SynthDef<span class="s3">(</span><span class="s4">\atari2600</span><span class="s3">, {</span>|out= 0, gate= 1, tone0= 5, tone1= 8, freq0= 10, freq1= 20, rate= 1, amp= 1, pan= 0|</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s2">var</span> e, z;</p>
<p class="p4"><span class="Apple-tab-span">	</span>e= <span class="s2">EnvGen</span>.kr(<span class="s2">Env</span>.asr(0.01, amp, 0.05), gate, doneAction:2);</p>
<p class="p4"><span class="Apple-tab-span">	</span>z= <span class="s2">Atari2600</span>.ar(tone0, tone1, freq0, freq1, 15, 15, rate);</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s2">Out</span>.ar(out, <span class="s2">Pan2</span>.ar(z*e, pan));</p>
<p class="p4">}).add;</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, 0.125,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(3, 64), <span class="s2">Pn</span>(2, 128), <span class="s2">Pn</span>(10, 8)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(8, 32), <span class="s2">Pwhite</span>(0, 15, 12)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(10, 17), <span class="s2">Pn</span>(<span class="s2">Prand</span>([1, 2, 3]), 4), <span class="s2">Pn</span>(10, 3)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([10, 3, <span class="s2">Pwrand</span>([20, 1], [0.6, 0.4])], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, <span class="s2">Pbrown</span>(0.1, 0.15, 0.1),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\tone0<span class="s3">, 1,</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\tone1<span class="s3">, 2,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([24, 24, <span class="s2">Pwrand</span>([20, 23], [0.6, 0.4])], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([1, 3, <span class="s2">Pwrand</span>([2, 1], [0.6, 0.4])], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, <span class="s2">Pseq</span>([0.06, 0.04], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, <span class="s2">Pseq</span>([10, 10, 10, 3], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, <span class="s2">Pseq</span>([3, 3, 3, 3, 10], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([1, 2, 3], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([10, 2, 13, 5], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, <span class="s2">Pseq</span>([0.25, 0.25, 0.25, 0.45], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, <span class="s2">Pseq</span>([<span class="s2">Pseq</span>([2, 5], 32), <span class="s2">Pseq</span>([3, 5], 32)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, 14,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([<span class="s2">Pbrown</span>(28, 31, 1, 32), <span class="s2">Pbrown</span>(23, 26, 3, 32)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(10, 16), <span class="s2">Pn</span>(11, 16)], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, 0.1,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, <span class="s2">Pseq</span>([<span class="s2">Pseq</span>([10, 2], 32), <span class="s2">Pseq</span>([1, 9], 32), <span class="s2">Pseq</span>([1, 2, 4], 36)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(10, 14, 16), <span class="s2">Pseries</span>(10, 5, 16)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(10, 31, 16), <span class="s2">Pseries</span>(27, 31, 16)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(9, 31, 16), <span class="s2">Pseries</span>(26, 31, 16)], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, 0.1,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\legato</span>, 1.5,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, 15,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(2, 80), <span class="s2">Pn</span>(3, 80), <span class="s2">Pn</span>(4, 80), <span class="s2">Pn</span>(0, 40)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(5, 0.1, 40)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(10, 0.05, 50)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\rate</span>, <span class="s2">Pseq</span>([<span class="s2">Pseries</span>(1, 1, 20)], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6">Pbind<span class="s3">(</span></p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>\instrument<span class="s3">, </span>\atari2600<span class="s3">,</span></p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\dur</span>, 0.1,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\amp</span>, 0.8,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\legato</span>, 1.2,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone0</span>, 15,</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\tone1</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(3, 40), <span class="s2">Pwhite</span>(3, 10, 8).round(3)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq0</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(11, 128), <span class="s2">Pn</span>(15, 128)], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\freq1</span>, <span class="s2">Pseq</span>([10, 3, <span class="s2">Pwrand</span>([2, 1], [0.6, 0.4])], <span class="s2">inf</span>),</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s4">\rate</span>, <span class="s2">Pseq</span>([<span class="s2">Pn</span>(1, 8), <span class="s2">Pn</span>(2, 8), <span class="s2">Pn</span>(1, 8), <span class="s2">Pn</span>(<span class="s2">Pwrand</span>([1.1, 1.5], [0.8, 0.2]), 8)], <span class="s2">inf</span>)</p>
<p class="p4">).play</p>
<p class="p4">)</p>
</body>
</html>
